package com.ikun.kunpicturebackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ikun.kunpicturebackend.domain.Space;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ikun.kunpicturebackend.domain.User;
import com.ikun.kunpicturebackend.model.dto.space.SpaceAddRequest;
import com.ikun.kunpicturebackend.model.dto.space.SpaceQueryRequest;
import com.ikun.kunpicturebackend.model.vo.SpaceVO;

import javax.servlet.http.HttpServletRequest;

/**
* @author 32144
* @description 针对表【space(空间)】的数据库操作Service
* @createDate 2025-10-07 16:49:38
*/
public interface SpaceService extends IService<Space> {

    /**
     * 校验空间信息
     * @param space 空间
     * @param create true:创建空间
     */
    void validSpace(Space space, boolean create);

    /**
     * 根据空间等级填充空间信息（限额信息）
     * @param space 空间
     */
    void fillSpaceBySpaceLevel(Space space);

    /**
     * 新增空间
     *
     * @param addRequest
     * @param loginUser  登录用户
     * @return
     */
    Long addSpace(SpaceAddRequest addRequest, User loginUser);

    /**
     * 校验空间权限
     * @param loginUser
     * @param space
     */
    void checkSpaceAuth(User loginUser, Space space);

    /**
     * 获取SpaceVO
     * @param space
     * @param request
     * @return
     */
    SpaceVO getSpaceVO(Space space, HttpServletRequest request);

    /**
     * 构造查询条件
     * @param spaceQueryRequest
     * @return
     */
    QueryWrapper<Space> getQueryWrapper(SpaceQueryRequest spaceQueryRequest);

    /**
     * 转换为Page<SpaceVO>
     * @param spacePage
     * @param request
     * @return
     */
    Page<SpaceVO> getSpaceVOPage(Page<Space> spacePage, HttpServletRequest request);
}
